/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.hicampus.common.service.impl;

import com.hicampus.common.model.Region;
import com.hicampus.common.service.base.RegionLocalServiceBaseImpl;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.Validator;

/**
 * The implementation of the region local service.
 * 
 * <p>
 * All custom service methods should be put in this class. Whenever methods are
 * added, rerun ServiceBuilder to copy their definitions into the
 * {@link com.hicampus.common.service.RegionLocalService} interface.
 * </p>
 * 
 * <p>
 * Never reference this interface directly. Always use
 * {@link com.hicampus.common.service.RegionLocalServiceUtil} to access the
 * region local service.
 * </p>
 * 
 * <p>
 * This is a local service. Methods of this service will not have security
 * checks based on the propagated JAAS credentials because this service can only
 * be accessed from within the same VM.
 * </p>
 * 
 * @author mpower
 * @see com.hicampus.common.service.base.RegionLocalServiceBaseImpl
 * @see com.hicampus.common.service.RegionLocalServiceUtil
 */
public class RegionLocalServiceImpl extends RegionLocalServiceBaseImpl {

	public Region getRegionByCC_RC(String countryCode, String regionCode)
			throws SystemException {
		return regionPersistence.fetchByCC_RC(countryCode, regionCode);
	}

	public String getRegionNameByCC_RC(String countryCode, String regionCode)
			throws SystemException {
		Region region = regionPersistence.fetchByCC_RC(countryCode, regionCode);
		if(Validator.isNotNull(region)) {
			return region.getRegionName();
		}
		return "";
	}
}